<template>
	<view class="hui b_width">
		<u-navbar leftIconColor="black" :autoBack="true" title="新手指南" titleStyle="color:black" :placeholder="true"
			bgColor="transparent">
		</u-navbar>
		<view class="list_box">
			<view class="info_box b_flex_c" v-for="(item,index) in list" :key="index" @click="$project.toPath('/pages/lock/guideInfo?title='+item.title+'&id='+item.id)">
				<view class="b_flex_cc">
					<image class="img" mode="widthFix" :src="item.imageInput"></image>
				</view>
				<view>
					<view>{{item.title}}</view>
					<view class="b_flex_c look_box">
						<image class="look" mode="widthFix" src="@/static/img/lock/look.png"></image>
						<view>{{item.visit}}阅读</view>
					</view>
				</view>
				<view class="b_flex_c right_box" >
					<view>点击查看</view>
					<image class="right" mode="widthFix" src="@/static/img/lock/right.png"></image>
				</view>
			</view>
		</view>
		<empty v-if="emptyShow" text='暂无指南'></empty>
	</view>
</template>

<script>
	import {articleList} from "@/require/api.js";
	import empty from "@/components/empty.vue";
	export default{
		data(){
			return{
				params: {
					page: 1,
					limit: 10,
					cid: 744,
				},
				list:[
				],
				total:'',
				emptyShow:false
			}
		},
		onShow() {
			if (this.params.page > 1) {
				this.params.limit = this.params.page * this.params.limit;
				this.params.page = 1;
			}
			this.getList();
		},
		onReachBottom() {
			if (this.list.length < this.total) {
				this.params.page++;
				articleList(this.params).then(res => {
					res.data.list.forEach((res) => {
						this.list.push(res);
					});
				});
			}
		},
		methods:{
			async getList() {
				let {
					data
				} = await articleList(this.params.cid,this.params);
				if (data.list.length < 1 || !data.list) {
					this.emptyShow = true;
				} else {
					this.emptyShow = false;
				}
				this.list = data.list;
				this.total = data.total;
			}
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep .u-navbar__content__title {
		font-size: 32rpx !important;
		font-weight: bold;
		color: #252B50 !important;
	}
	.list_box{
		box-sizing: border-box;
		padding:20rpx 40rpx;
	}
	.info_box{
		background-color: #fff;
		box-sizing: border-box;
		padding: 40rpx 30rpx;
		border-radius: 15rpx;
		margin-bottom: 30rpx;
	}
	.s_box{
		width: 116rpx;
		height: 116rpx;
		border-radius: 50%;
		background-color:#3C7CFF;
		margin-right: 30rpx;
		color: #252B50;
	}
	.img{
		width: 116rpx;
		
		margin-right: 30rpx;
	}
	.right{
		width: 13rpx;
		margin-left: 10rpx;
	}
	.right_box{
		color: #9296AF;
		font-size: 25rpx;
		margin-left: auto;
	}
	.look{
		width: 35rpx;
		margin-right: 10rpx;
	}
	.look_box{
		margin-top: 20rpx;
		color: #9296AF;
		font-size: 26rpx;
	}
</style>